package hqu.cst.xah.mapper;

import hqu.cst.xah.pojo.Order;
import hqu.cst.xah.pojo.Product;
import org.apache.ibatis.annotations.*;

@Mapper
public interface OrderMapper {

    @Insert("INSERT INTO orders (product_Id, quantity, total_price, status, order_date) " +
            "VALUES (#{productId}, #{quantity}, #{totalPrice}, #{status}, NOW())")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(Order order);

    @Select("select * from orders where id=#{id}")
    Order selectById(Long id);

    @Update("update orders set quantity=#{quantity},total_price=#{totalPrice},status=#{status} where id=#{id}")
    void updateById(Order order);

}

